#include "smarthomecontrol.h"


SmartHomeControl::SmartHomeControl(QWidget *parent)
    : QWidget{parent}
{
    setStyleSheet(R"(
        QLabel {
            font-size: 18px;
            font-weight: bold;
        }
    )");
   
    label_1=new QLabel();
    label_1->setText("label_1");
    label_1->setScaledContents(true);
    label_1->setAlignment(Qt::AlignCenter);
    button=new Button_home_start();
    button->setPixmap(QPixmap(":/状态按钮_关"));
    label_3=new QLabel();
    label_3->setText("label_3");
    label_3->setScaledContents(true);
    label_4=new QLabel();
    label_4->setText("label_4");
    label_4->setScaledContents(true);
    label_4->setFixedSize(60,60);
    // 垂直布局
    QVBoxLayout *vlayout=new QVBoxLayout(this);
    // 两个水平布局
    QHBoxLayout *hlayout_1=new QHBoxLayout();
    QHBoxLayout *hlayout_2=new QHBoxLayout();
    vlayout->addLayout(hlayout_1);
    vlayout->addLayout(hlayout_2);
    
    hlayout_1->addWidget(label_1);
    hlayout_1->addWidget(button);
    hlayout_2->addWidget(label_3);
    hlayout_2->addWidget(label_4);
    
}


void SmartHomeControl::set_label_1(QString text){
    label_1->setText(text);
}

void SmartHomeControl::set_label_3(QString text){
    label_3->setText(text);
}

void SmartHomeControl::set_label_4(QPixmap pixmap){
    label_4->setPixmap(pixmap);
}

QLabel *SmartHomeControl::get_label_4()
{
    return label_4;
}

QLabel * SmartHomeControl::get_label_1(){
    return label_1;
}

QLabel * SmartHomeControl::get_label_3(){
    return label_3;
}

Button_home_start *SmartHomeControl::getButton()
{
    return button;
}

